import { request } from "../../request/request.js";
import regeneratorRuntime from '../../lib/runtime/runtime';
import { login } from "../../utils/asyncWx.js";

Page({
  // 用户信息的获取
  async handleGetUserInfo(e) {
    // 1 获取用户信息
    //const { encryptedData, rawData, iv, signature } = e.detail;
    // 2 获取小程序登录成功后的code
    //const { code } = await login();
    //const loginParams={ encryptedData, rawData, iv, signature ,code};
    //  3 发送请求 获取用户的token
    //const {token}=await request({url:"/users/wxlogin",data:loginParams,method:"post"});
    // 4 把token存入缓存中 同时跳转回上一个页面
    //wx.setStorageSync("token", token);
    wx.cloud.database().collection("userinfo").doc("0bcbdde05fd3631b0120de2846b534b7").update({
      data: {
        payauth:true
      },
    }).then(res =>{
      console.log(res)
    })
    wx.navigateBack({
      delta: 1
    });

  }
})